﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CauseGoodStudents.aspx.cs" Inherits="Credit_Teacher_Reprots_CauseGoodStudents" %>

<%@ Register Src="../../../Custom/SchoolYear.ascx" TagName="SchoolYear" TagPrefix="uc1" %>

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>优秀学生学期评比</title>
    <link href="../../Common/css/main.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../Common/js/TableForExport.js"></script>
    <script type="text/javascript"  >
        var currGrade = 0;
        function Load()
        {
            Select();
        }
        function Select()
        {
            document.getElementById('<%=txtSchoolYear.ClientID %>').value = GetCurrentYear;
            document.getElementById('<%=txtTerm.ClientID %>').value = GetCurrentTerm; 
            document.getElementById('<%=txtGrade.ClientID %>').value = currGrade; 
            Bind();
        }
        
        function FilterGrade()
        {
            var value = event.srcElement.value;
            currGrade = value;
        }
        
        function Bind()
        {
            document.getElementById('btnBind').click();
        }
        
        function getExcel()
        {
            var selClass =document.getElementById('selGrade');
            var className = selClass.options[selClass.selectedIndex].text;
            var cells = GetTableInfo(document.getElementById('settingTable'));
            if(cells!=null)
            {
                PageMethods.GetExcel(GetCurrentYear,GetCurrentTerm,className,cells,function(result){
                document.getElementById('downloadf').src = "";
                document.getElementById('downloadf').src = "../../../PostFileBytes.aspx";
        //            window.location.href = "../../../PostFileBytes.aspx";
                },function(err){alert(err._message);alert(err._message);});
            }
            
        }
    </script>
</head>
<body  style="height:85%;padding-top:5px;padding-left:5px;" onload="Load();">
<form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
        </asp:ScriptManager>
            <div class="pageBody">
            <div class="mainWarp" >
                <table >
                <tr>
                <td  style="padding-left:4px;">
                 <uc1:SchoolYear ID="SchoolYear1" runat="server" />
                 <select style=" width:80px;" id="selGrade" onclick="FilterGrade();">
                    
                 </select> 
                </td>
                <td style="padding-left:10px;">
                   <input id="Button1" type="button" value="查询" class="commonBut" style="display:block;"   onclick="Select()"/>
                   
                </td>
                 <td style="padding-left:10px;">
                    <asp:UpdateProgress ID="UpdateProgress1"  runat="server" AssociatedUpdatePanelID="upClass"><progresstemplate><img src="../../Common/images/ajaxloading.gif" /></progresstemplate></asp:UpdateProgress>
                </td>
                
                <td style="padding-left:10px;">
                   <input id="Button2" type="button" value="导出Excel" class="commonBut"  style="display:block;" onclick="getExcel()" />
                </td>
                </tr>
                </table>

                <div style="overflow-y:auto;overflow-x:none;height:98%;">优秀学生学期评比一览表：<br>
                    <asp:UpdatePanel ID="upClass" runat="server">
                        <ContentTemplate>
                            <table id="settingTable" border="0" cellpadding="0" cellspacing="1"  class="useList1">
                              <asp:Repeater ID="repeater1" runat="server">
                                <HeaderTemplate> 
                                    <%# InitTableHead()%> 
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%# InitTableBody() %>
                                </ItemTemplate>
                                </asp:Repeater>
                            </table>
                     <div style="display: none;">
                        <asp:Button ID="btnBind" runat="server" Text="btnBind" OnClick="btnBind_Click" />
                        <asp:TextBox ID="txtSchoolYear" runat="server" />
                        <asp:TextBox ID="txtTerm" runat="server" />
                        <asp:TextBox ID="txtGrade" runat="server" />
                     </div>    
                        
                            
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="btnBind" EventName="Click" />
                       </Triggers>
                    </asp:UpdatePanel>
                </div>
               


            </div>
        </div>
        
    </form>
    <div id="upInputPop" class="layoutWarp" style="display: none">
        <iframe src="" name="downloadf" id="downloadf" style="height: 80%;width: 95%;overflow-y:auto;overflow-x:none;" frameborder="0"   ></iframe>
    </div>
</body>
</html>
<script type="text/javascript">
<%
    SetGrade();
 %>
 document.getElementById('selGrade').click();
 document.getElementById('UpdateProgress1').style.display="";
</script>
